<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">

/* tooltip */
#tooltip{
  position:absolute;
  border:1px solid #ccc;
  background:#333;
  padding:2px;
  display:none;
  color:#fff;
}
</style>
</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">科普活动</li>
        <li><a href="{:url('admin/activity/publishee')}" class="a_menu">增加活动</a></li>
      </ul>
    </div> 
    <form class="layui-form serch" action="{:url('admin/admin/index')}" method="post">
        <div class="layui-form-item" style="float: left;">
          <div class="layui-input-inline">
            <input type="text" name="keywords" lay-verify="title" autocomplete="off" placeholder="请输入关键词" class="layui-input layui-btn-sm">
          </div>
          <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
        </div>
      </form> 
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="50">
        <col width="100">
        <col width="150">
        <col width="120">
        <col width="50">
        <col width="100">
        <col width="200">
        <col width="200">
        <col width="100">
      </colgroup>
      <thead>
        <tr>
          <th>头像</th>
          <th>标题</th>
          <th>活动简介</th>
          <th>创建时间</th>
          <th>状态</th>
          <th>产看参加的人员</th>
          <th>操作</th>
        </tr> 
      </thead>
      <tbody>
        {volist name="list" id="vo"}
        <tr>
          <td><a href="{$vo.filepath}" class="tooltip"><img src="{$vo.filepath}" width="20" height="20"></a></td>
          <td>{$vo.title}</td>
          <td>{$vo.description}</td>
          <td>{:date('Y年m月d日 H:i',$vo['time'])}</td>
          <td>        
            {switch name="$vo.status"}
            {case value="2"}<div style="color: #fff;background-color: red;text-align: center;">已拒绝</div>{/case}
            {case value="1"}<div style="color: #fff;background-color: mediumseagreen;text-align: center;">已审核</div>{/case}
            {default /}<div style="color: #fff;background-color: burlywood;text-align: center;">待审核</div>
            {/switch}
          </td>
          <td><a href="{:url('activity/see',['id'=>$vo.id])}">产看详细</a></td>
          <td class="operation-menu">
            <div class="layui-btn-group">
              <a class="layui-btn layui-btn-xs open layui-btn-primary" data-id="{$vo.id}" style="margin-right: 0;font-size:12px;">
                <i class="fa fa-cog" {if condition="$vo.status eq 1"}fa-toggle-on{else/}fa-toggle-off{/if} aria-hidden="true" style="margin-top: 4px;"></i>
              </a>
              <a href="{:url('activity/cg',['id'=>$vo.id])}" class="layui-btn layui-btn-xs a_menu layui-btn-primary" id="" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
              <a class="layui-btn layui-btn-xs layui-btn-primary delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
            </div>
          </td>
        </tr>
        {/volist}
      </tbody>
    </table>
    <div style="padding:0 20px;">{$pag}</div>

    {include file="public/foot"}
    
    <script type="text/javascript">

    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要删除?', function(index) {
        $.ajax({
          url:"{:url('admin/activity/deletekkk')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
                layer.alert('删除成功！',{icon:2});
                location.reload();
            }
          }
        })
      })
    })
    </script>
        <script type="text/javascript">
            layui.use('layer', function(){
              var layer = layui.layer;
              $('.open').click(function(){
                var id = $(this).attr('data-id');
                layer.msg('文件审核',{
                  time:20000
                  ,btn: ['通过审核', '残忍拒绝', '再想想']
                  ,yes: function(index, layero){
                    $.ajax({
                      url:"{:url('admin/activity/auditirt')}"
                      ,type:'post'
                      ,data:{id:id,status:'1'}
                      ,success:function(res){
                        layer.msg(res.msg);
                        if(res.code == 1){
                          setTimeout(function(){
                            location.href = res.url;
                          },1500)
                        }
                      }
                    })
                  }
                  ,btn2: function(index, layero){
                    $.ajax({
                      url:"{:url('admin/activity/auditirt')}"
                      ,type:'post'
                      ,data:{id:id,status:'2'}
                      ,success:function(res){
                        layer.msg(res.msg);
                        if(res.code == 1){
                          setTimeout(function(){
                            location.href = res.url;
                          },1500)
                        }
                      }
                    })
                  }
                })
              })
            });              
          </script>
  </div>
</body>
</html>